home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Pane2 / c / GetPNumber < prev    next >
Text File  |  1995-08-23  |  2KB  |  69 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Pane2.GetPNumber.c
  12.     Author:  Copyright © 1995 Andrew Sellors.
  13.     Version: 1.04 (4th August 1995)
  14.     Purpose: Handles windows with panes.
  15. */
  16.  
  17. #include "DeskLib:Pane2.h"
  18. #include "Pane2Defs.h"
  19. #include "Desklib:Event.h"
  20. #include "DeskLib:Template.h"
  21. #include "Desklib:EventMsg.h"
  22. #include "Desklib:Error.h"
  23.  
  24. #include <stdlib.h>
  25.  
  26.  
  27. /******************************************************************************/
  28.  
  29. extern int Pane2_GetPaneNumber(window_handle mainwindow, window_handle panewindow)
  30. {
  31.  /*
  32.   * Returns pane number of 'panewindow' attatched to 'mainwindow' or 0 if the
  33.   * window was not found.
  34.   */
  35.   main_listelement *mainelement;
  36.   pane_listelement *paneelement;
  37.   int panecount;
  38.  
  39.  /*
  40.   * find element for main window and return 0 if mainwindow not present
  41.   */
  42.   mainelement = FindMainWindow(mainwindow);
  43.   if(mainelement == NULL)
  44.      return(0); /* not found */
  45.  
  46.  /*
  47.   * find first pane window
  48.   */
  49.   paneelement = LinkList_FirstItem(&(mainelement->paneanchor));
  50.  
  51.   panecount = 1;
  52.  
  53.   while(paneelement != NULL){
  54.  
  55.      if(paneelement->panewindow == panewindow)
  56.         return(panecount); /* pane window found */
  57.  
  58.     /*
  59.      * find next pane window
  60.      */
  61.      paneelement = LinkList_NextItem(&(paneelement->header));
  62.  
  63.      panecount++;
  64.   }
  65.  
  66.   return(0); /* not found */
  67.  
  68. }
  69.